﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using ExamDemo.Models;

namespace ExamDemo.Data
{
    public class Datalnitlizer:DropCreateDatabaseIfModelChanges<ExamDemoContext>
    {
        protected override void Seed(ExamDemoContext db)
        {
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="小猫咪",
                    Password="123"
                },new Users
                {
                    Username="小狗",
                    Password="123"
                },new Users
                {
                    Username="fei",
                    Password="123"
                },new Users
                {
                    Username="a",
                    Password="a"
                },
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="天气真好！"
                },new Messages
                {
                    FromUserId=2,
                    Content="吃什么呢？"
                },new Messages
                {
                    FromUserId=3,
                    Content="干饭啦！🍚"
                },new Messages
                {
                    FromUserId=4,
                    Content="冲冲冲"
                },new Messages
                {
                    FromUserId=1,
                    Content="走！"
                }
            });

            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId=1,
                    ToUserId=9,
                    Comment="来了"
                }
            });

            db.SaveChanges();

            base.Seed(db);
        }
    }
}
